﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LoungeRepo.Contracts.Core;
using LoungeRepo.Core;

namespace Using_collections
{
    class Program
    {
        static void Main(string[] args)
        {
            using(var repo = new LoungeRepository())
            {
                var personExtent = new List<Person>
                                       {
                                           new Person {Name = "Peter", City = "New York"},
                                           new Person {Name = "Paul", City = "Boston"},
                                           new Person {Name = "Mary", City = "Moscow"}
                                       };

                personExtent[0].Aquaintances.Add(personExtent[2]);
                personExtent[1].Aquaintances.Add(personExtent[2]);

                personExtent[2].Aquaintances.Add(personExtent[0]);
                personExtent[2].Aquaintances.Add(personExtent[1]);

                repo.Store(personExtent, "personExtent");

                personExtent = repo.Load<List<Person>>("personExtent");

                foreach(Person p in personExtent)
                {
                    Console.WriteLine(p);
                    foreach (Person a in p.Aquaintances)
                        Console.WriteLine("  {0}", a);
                }
            }
        }
    }
}
